from comtypes.client import CreateObject

engine = CreateObject("SAPI.SpVoice")
stream = CreateObject('SAPI.SpFileStream')

from comtypes.gen import SpeechLib

infile = './demo.txt'
outfile = 'demo_audio.wav'

stream.Open(outfile, SpeechLib.SSFMCreateForWrite, True)
engine.AudioOutputStream = stream

f = open(infile, 'r', encoding='utf-8')
theText = f.read()
f.close()

engine.Speak(theText)
stream.Close()